/*
 * Copyright (c) 2008-2013 Haulmont. All rights reserved.
 * Use is subject to license terms, see http://www.cuba-platform.com/license for details.
 */

package com.haulmont.asu.entity;

import com.haulmont.chile.core.annotations.NamePattern;
import com.haulmont.cuba.core.entity.StandardEntity;

import javax.persistence.*;
import java.util.Set;

/**
 * Author: Sergey42
 * Date: 17.10.13 14:09
 */
@Table(name = "ASU_STEP")
@Entity(name = "asu$Step")
@NamePattern("%s|name")
public class Step extends StandardEntity {

    private static final long serialVersionUID = 4384622866537248376L;

    @Column(name = "NAME", length = 50)
    protected String name;

    @Column(name = "STEP_ORDER")
    protected Integer order;

    @ManyToOne
    @JoinColumn(name = "STAGE_ID")
    protected Stage stage;

    @OneToMany(mappedBy = "step")
    @OrderBy("order")
    protected Set<Work> works;

    @ManyToOne
    @JoinColumn(name = "PROJECT_ID")
    protected Project project;

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getOrder() {
        return order;
    }

    public void setOrder(Integer order) {
        this.order = order;
    }

    public Stage getStage() {
        return stage;
    }

    public void setStage(Stage stage) {
        this.stage = stage;
    }

    public Set<Work> getWorks() {
        return works;
    }

    public void setWorks(Set<Work> works) {
        this.works = works;
    }
}
